package com.fzh.bookstore.biz.banner.controller;


import com.fzh.bookstore.biz.banner.dto.BannerListRequest;
import com.fzh.bookstore.biz.banner.dto.BannerPositionRequest;
import com.fzh.bookstore.biz.banner.service.BannerService;
import com.fzh.bookstore.dto.SuperResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author fang
 * @since 2021-02-25
 */
@RestController
@RequestMapping("/banner")
@Api(value = "广告模块",tags = {"广告模块"})
public class BannerController {


    @Autowired
    private BannerService bannerService;


    @PostMapping("/getBanner")
    @ApiOperation(value = "获取Banner(App)" ,notes = "")
    public SuperResponse getBanner(@Valid @RequestBody BannerPositionRequest request ){
        return  bannerService.getBannerByPosition(request);
    }


    @PostMapping("/list")
    @ApiOperation(value = "banner列表" ,notes = "")
    public SuperResponse list(@Valid @RequestBody BannerListRequest request ){
        return  bannerService.list(request);
    }

}

